package com.iris.live.services.data.repositories;

import com.iris.live.services.data.models.团内客户表Model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author: luojie
 * date: 2017/12/15 15:05
 */
@Transactional
public interface 团内客户表Repository extends JpaRepository<团内客户表Model, Integer>, JpaSpecificationExecutor<团内客户表Model> {
    @Query("select a from 团内客户表Model a where a.许可 = ?1 and a.企业名称 = ?2 and a.社会信用代码 = ?3 ")
    团内客户表Model findByCompanyNameAndCreditCode(String permit, String companyName, String creditCode);

    @Modifying
    @Query("update 团内客户表Model a set a.状态= ?1 where a.编号 in ?2")
    int updateGroupCustomerStatus(String status, List idList);
}